package com.finance.system.user.service;


import com.finance.system.support.IBaseService;
import com.finance.system.support.bean.OffsetQuery;
import com.finance.system.support.bean.ResultBean;
import com.finance.system.user.entity.GroupEntity;
import com.finance.system.user.entity.GroupInbound;
import com.finance.system.user.entity.UserEntity;
import com.finance.system.user.entity.UserGroupRelationEntity;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author whdong
 * @since 2019-10-11
 */
public interface IUserGroupRelationService extends IBaseService<UserGroupRelationEntity> {
    List<UserGroupRelationEntity> getByUserId(String userId,
                                              OffsetQuery<UserGroupRelationEntity> offsetQuery);

    List<UserGroupRelationEntity> getByGroupId(String groupId,
                                               OffsetQuery<UserGroupRelationEntity> offsetQuery);

    /**
     * 查询用户的所有账本
     * @param userId
     * @return
     */
    ResultBean<List<GroupEntity>> getGroupByUserId(String userId);

    /**
     * 根据账本id查询所有组成员
     * @param groupId
     * @return
     */
    ResultBean<List<UserEntity>> getUserByGroupId(String groupId);

    /**
     * 账本编辑
     * @param group
     * @return
     */
    ResultBean<GroupEntity> updateGroup(GroupInbound group);

    /**
     * 新增账本
     * @param group
     * @return
     */
    ResultBean<GroupEntity> addOne(GroupInbound group);

    ResultBean addUserInToGroup(UserGroupRelationEntity relation);
}
